package com.yyaccp.hncc.sms.service.impl;

import java.util.List;

import com.yyaccp.hncc.sms.domain.SmsSkdRule;
import com.yyaccp.hncc.sms.service.ISmsSkdRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yyaccp.hncc.sms.mapper.SmsSkdRuleItemMapper;
import com.yyaccp.hncc.sms.domain.SmsSkdRuleItem;
import com.yyaccp.hncc.sms.service.ISmsSkdRuleItemService;

/**
 * 排版规则详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-08-23
 */
@Service
public class SmsSkdRuleItemServiceImpl implements ISmsSkdRuleItemService 
{
    @Autowired
    private SmsSkdRuleItemMapper smsSkdRuleItemMapper;
    @Autowired
    private ISmsSkdRuleService smsSkdRuleService;
    /**
     * 查询排版规则详情
     * 
     * @param id 排版规则详情ID
     * @return 排版规则详情
     */
    @Override
    public SmsSkdRuleItem selectSmsSkdRuleItemById(Long id)
    {
        return smsSkdRuleItemMapper.selectSmsSkdRuleItemById(id);
    }

    /**
     * 查询排版规则详情列表
     * 
     * @param smsSkdRuleItem 排版规则详情
     * @return 排版规则详情
     */
    @Override
    public List<SmsSkdRuleItem> selectSmsSkdRuleItemList(SmsSkdRuleItem smsSkdRuleItem)
    {
        return smsSkdRuleItemMapper.selectSmsSkdRuleItemList(smsSkdRuleItem);
    }

    /**
     * 新增排版规则详情
     * 
     * @param smsSkdRuleItem 排版规则详情
     * @return 结果
     */
    @Override
    public int insertSmsSkdRuleItem(SmsSkdRuleItem smsSkdRuleItem)
    {
        SmsSkdRule smsSkdRule=smsSkdRuleService.selectSmsSkdRuleDate();
        smsSkdRuleItem.setStatus(1);
        smsSkdRuleItem.setSkRuleId(smsSkdRule.getId());
        return smsSkdRuleItemMapper.insertSmsSkdRuleItem(smsSkdRuleItem);
    }

    /**
     * 修改排版规则详情
     * 
     * @param smsSkdRuleItem 排版规则详情
     * @return 结果
     */
    @Override
    public int updateSmsSkdRuleItem(SmsSkdRuleItem smsSkdRuleItem)
    {
        return smsSkdRuleItemMapper.updateSmsSkdRuleItem(smsSkdRuleItem);
    }

    /**
     * 批量删除排版规则详情
     * 
     * @param ids 需要删除的排版规则详情ID
     * @return 结果
     */
    @Override
    public int deleteSmsSkdRuleItemByIds(Long[] ids)
    {
        return smsSkdRuleItemMapper.deleteSmsSkdRuleItemByIds(ids);
    }

    /**
     * 删除排版规则详情信息
     * 
     * @param id 排版规则详情ID
     * @return 结果
     */
    @Override
    public int deleteSmsSkdRuleItemById(Long id)
    {
        return smsSkdRuleItemMapper.deleteSmsSkdRuleItemById(id);
    }
}
